@echo off
echo ========================================
echo 强制重启后端服务（确保代码生效）
echo ========================================

echo.
echo 1. 停止所有Java进程...
taskkill /f /im java.exe 2>nul
timeout /t 2 >nul

echo.
echo 2. 清理编译缓存...
cd lekang-admin
if exist target (
    echo 删除 lekang-admin/target...
    rd /s /q target
)
cd ..

cd lekang-lkyl
if exist target (
    echo 删除 lekang-lkyl/target...
    rd /s /q target
)
cd ..

echo.
echo 3. 重新编译项目...
call mvn clean compile -DskipTests
if %errorlevel% neq 0 (
    echo 编译失败！
    pause
    exit /b 1
)

echo.
echo 4. 启动后端服务...
cd lekang-admin
start "乐康后端服务" cmd /k "mvn spring-boot:run"

echo.
echo ========================================
echo 后端服务已启动！
echo 请等待服务启动完成，然后刷新浏览器页面
echo 查看控制台日志以确认配置生效
echo ========================================
echo.
echo 关键日志输出：
echo - "========== 任务安排查询 =========="
echo - "当前用户ID: XXX"
echo - "检测到护理员角色(roleId=100)，添加executorId过滤"
echo - "查询参数: {executorId=XXX, ...}"
echo - "查询结果数量: X"
echo.
pause

